﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;

namespace VodafoneLiveTile
{
    public class Account
    {
        public string username;
        public string password;
        public string number;
        public bool showDate;
        public bool enableLiveTile;
        public bool enableToast;
        public bool autoUpdate;
        public List<String> othersNumbers;
        public int counter;
        public string tileUri;
        public string toastUri;
        public bool isBusiness;
        public Account()
            : this("", "", "", 1, false, false)
        {

        }
        public Account(string username, string password)
            : this(username, password, "", 1, false, false)
        {
        }
        public Account(string username, string password, string number, int counter, bool showDate, bool isBusiness)
        {
            this.username = username;
            this.password = password;
            this.number = number;
            this.showDate = showDate;
            this.counter = counter;
            this.enableLiveTile = true;
            this.enableToast = true;
            this.autoUpdate = true;
            othersNumbers = new List<string>();
            tileUri = "";
            toastUri = "";
            this.isBusiness = isBusiness;
        }
        public override bool Equals(object obj)
        {
            if (!(obj is Account))
                return false;
            Account a = (Account)obj;
            bool ok = username == a.username &&
                password == a.password &&
                number == a.number &&
                autoUpdate == a.autoUpdate &&
                showDate == a.showDate &&
                counter == a.counter &&
                enableLiveTile == a.enableLiveTile &&
                enableToast == a.enableToast &&
                isBusiness == a.isBusiness &&
                othersNumbers.Count == a.othersNumbers.Count;
            if (!ok)
                return false;
            for (int i = 0; i < othersNumbers.Count; i++)
                if (othersNumbers[i] != a.othersNumbers[i])
                    return false;

            return true;
        }
        public override int GetHashCode()
        {
            return base.GetHashCode();
        }

        public bool isActive()
        {
            return username != "" && password != "" &&
                counter >= 1;
        }
        public bool isFirstNumber()
        {
            return !(othersNumbers.Count > 0 && number != othersNumbers[0]);
        }
    }

    public class Counter
    {
        public int Id;
        public string Name;
        public string Desc;
        public Counter()
            :this(0,"", "")
        {
        }
        public Counter(int id, string name, string desc)
        {
            this.Id = id;
            this.Name = name;
            this.Desc = desc;
        }
    }
}
